# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=baloo-widgets
pkgver=23.08.4
pkgrel=0
pkgdesc="Widgets for Baloo"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://community.kde.org/Baloo"
license="LGPL-2.0-only AND LGPL-2.1-or-later"
depends_dev="
	baloo5-dev
	kconfig5-dev
	kfilemetadata5-dev
	ki18n5-dev
	kio5-dev
	qt5-qtbase-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	samurai
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/libraries/baloo-widgets.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/baloo-widgets-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# filemetadatadatedisplaytest, filemetadatawidgettest and filemetadataitemcounttest
	# require running dbus server
	local skipped_tests="("
	local tests="
		filemetadatadatedisplay
		filemetadatawidget
		filemetadataitemcount"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)|test"
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
c076776cd4c212182d59f2f1b1b6fc7b0909f914451331eb8078186008ee0dd60fe218bf81a1c49f3949b10b258e0dad89f9c731dff770a396f3f978fcb233be  baloo-widgets-23.08.4.tar.xz
"
